package smedi.ismedi.mobile.bff.dto.quality;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import smedi.ismedi.mobile.bff.infrastructure.constant.HiddenDangerField;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;

/**
 * @author yangzhenzhou
 * @date 2022/10/24
 */
@Data
public class AvailableHiddenDangerRequest {
    @ApiModelProperty(value = "隐患来源 安全模块:SFC,质量模块:QLT",required = true)
    @NotBlank(message = "隐患来源不能为空")
    private String hiddenDangerSource;
    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id",required = true)
    @NotNull(message = "项目id不能为空")
    private Long projectId;

    /**
     * 隐患状态
     */
    @ApiModelProperty(value = "隐患状态( 退回整改:BACK,待整改:RECTIFICATION,待复查:REVIEW,已关闭:CLOSED,已完成:FINISHED)")
    private String hiddenDangerStatus;

    /**
     * 隐患类型
     */
    @ApiModelProperty(value = "隐患类型 一般:GENERIC,重大:SERIOUS")
    private String hiddenDangerType;

    /**
     * 超期状态
     */
    @ApiModelProperty(value = "超期状态 正常:NORMAL,超期完成:OVERCOMPLETE,超期未完成:OVERUNFINISHED,超期关闭:OVERCLOSE")
    private String overStatus;

    /**
     * 检查类型
     */
    @ApiModelProperty(value = "检查类型 (日常检查:DAILY_CHECK,专项检查:SPECIAL_CHECK)")
    private String checkType;

    /**
     * 检查性质
     */
    @ApiModelProperty(value = "检查性质  [项目检查:PROJECT_CHECK,主体院检查:PARENT_CHECK,总院检查:HEADQUARTERS_CHECK]")
    private String checkCharacter;


    /**
     * 我的操作
     */
    @ApiModelProperty(value = "我的操作 (我创建的:MY_CREATE,我整改的:MY_RECTIFICATION,我复查的:MY_REVIEW,抄送我的:NOTIFY_ME)")
    private String operaType;

    /**
     * 检查开始时间
     */
    @ApiModelProperty(value = "检查开始时间", example = "2022-01-01")
    private LocalDate checkStartDate;

    /**
     * 检查结束时间
     */
    @ApiModelProperty(value = "检查结束时间", example = "2022-01-01")
    private LocalDate checkEndDate;

    /**
     * App模糊查询条件
     */
    @ApiModelProperty(value = "模糊查询条件")
    private String keyWord;


    /**
     * 页码
     */
    @ApiModelProperty(value = "当前页码", example = "1", required = true)
    @NotNull(message = "当前页码不能为空")
    private Long pageNum;

    /**
     * 每页行数
     */
    @ApiModelProperty(value = "每页行数", example = "10", required = true)
    @NotNull(message = "每页行数不能为空")
    private Long pageSize;


    public String getHiddenDangerStatus(){
        if("SFC".equals(this.hiddenDangerSource)){
            return HiddenDangerField.StatusEnum.getName(this.hiddenDangerStatus);
        }else{
            return this.hiddenDangerStatus;
        }
    }

    public String getHiddenDangerType(){
        if("SFC".equals(this.hiddenDangerSource)){
            return HiddenDangerField.HiddenDangerTypeEnum.getName(this.hiddenDangerType);
        }else{
            return this.hiddenDangerType;
        }
    }

    public String getCheckCharacter(){
        if("SFC".equals(this.hiddenDangerSource)){
            return HiddenDangerField.CheckCharacterNum.getName(this.checkCharacter);
        }else{
            return this.checkCharacter;
        }
    }

    public String getCheckType(){
        if("SFC".equals(this.hiddenDangerSource)){
            return HiddenDangerField.CheckTypeEnum.getName(this.checkType);
        }else{
            return this.checkType;
        }
    }

    public String getOperaType(){
        if("SFC".equals(this.hiddenDangerSource)){
            return HiddenDangerField.OperaTypeEnum.getName(this.operaType);
        }else{
            return this.operaType;
        }
    }

    public String getOverStatus(){
        if("SFC".equals(this.hiddenDangerSource)){
            return HiddenDangerField.OverStatusEnum.getName(this.overStatus);
        }else{
            return this.overStatus;
        }
    }

}
